//点击input表单实现 全选或反选
$(function () {
    //全选
    $("input#select_all").click(function () {
        $("[type='checkbox']").attr("checked", $(this).attr("checked") == "checked");
    })
})
//全选文章
function select_all() {
    $("[type='checkbox']").attr("checked", "checked");
}
//反选文章
function reverse_select() {
    $("[type='checkbox']").attr("checked", function () {
        return !$(this).attr("checked") == 1;
    });
}

function del() {
	var ids = $("input:checked").serialize();
    if (ids) {
        if (confirm("确定要删除文章吗?")) {
            $.ajax({
                type: "POST",
                url: CONTROLLER + "&a=del",
                dataType: "JSON",
                cache: false,
                data: ids,
                success: function (data) {
                    if (data.state == 1) {
                        hd_alert({ 
                            message: data.message,
                            timeout: 3,
                            success: function () {
                                location.href = URL;
                            } 
                        })
                    } else {
                        hd_alert({ 
                            message: data.message,
                            timeout: 3,
                            success: function () {
                                location.href = URL;
                            } 
                        })
                    }
                }
            })
        }
    } else {
        alert("请选择删除的文章");
    }
}
